fix(react): Add support for cross-usage of React Router instrumentations#15283
Merged
AbhiPrasad merged 8 commits intodevelopfrom Feb 25, 2025
Merged
fix(react): Add support for cross-usage of React Router instrumentations#15283AbhiPrasad merged 8 commits intodevelopfrom
AbhiPrasad merged 8 commits intodevelopfrom
Conversation
07b80f0 to
b4dfd0e
Compare
3 tasks
b2480b5 to
5f36173
Compare
❌ 1 Tests Failed:
View the top 1 failed test(s) by shortest run time
To view more test analytics, go to the Test Analytics Dashboard |
Contributor
size-limit report 📦
|
186754b to
24c7931
Compare
24c7931 to
4081708
Compare
chargome
reviewed
Feb 10, 2025
| }, | ||
| }); | ||
| const activeSpan = getActiveSpan(); | ||
| const isAlreadyInNavigationSpan = activeSpan && spanToJSON(activeSpan).op === 'navigation'; |
Member
There was a problem hiding this comment.
Could we not also get that directly from the span?
Collaborator
Author
There was a problem hiding this comment.
Looking at the rest of the uses in the repo, I think op is obtained like this. Could not see a way to get it directly from the span.
Member
There was a problem hiding this comment.
I think we can remove all server related code from this test
| "express": "4.20.0", | ||
| "react": "18.2.0", | ||
| "react-dom": "18.2.0", | ||
| "react-router-dom": "^6.28.0", |
Member
There was a problem hiding this comment.
Wdyt about testing this one on v7?
Collaborator
Author
|
Thanks for the review, and sorry for the late updates @chargome. |
chargome
approved these changes
Feb 25, 2025
Contributor
|
I caused a merge conflict for this 😅 - sorry about that! Should be easy to rebase though. |
9fcb54f to
88fac09
Compare
AbhiPrasad
approved these changes
Feb 25, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This started to be an issue after we added support for descendant React Router routes.
React Router does not limit users to only one way to declare routes. Currently, we provide instrumentation for 3 ways of declaring RR routes:
useRoutesSentry.wrapUseRoutes<Routes />Sentry.withReactRouterRoutingcreateBrowserRouterSentry.wrapCreateBrowserRoutercreateHashRouterSentry.wrapCreateBrowserRoutercreateMemoryRouterSentry.wrapCreateMemoryRouterWhen users decide to declare their routes using more than one of these options together, we risk losing context while rebuilding parameterised span names.
This PR adds: